<template>
  <div id="app">
    <div class="row ">
      <!--header-row-phone-->
      <div class="col-md-2  visible-xs-block">
        <Phonemenu/>
      </div>
      <!--header-row-PC-->
      <div class="col-md-2 header-row hidden-xs">
        <Header/>
      </div>
      <div class="col-md-10 appRight-row">
        <router-view class="appRight"/>
      </div>
    </div>
  </div>
</template>

<script>
  import Header from "./components/Header";
  import Phonemenu from "./components/Phonemenu";

  export default {
    name: "App",
    data() {
      return {
        visitNum:null
      }
    },
    components: {
      Header,
      Phonemenu
    },
    created() {
      this.setVisit();
    },
    mounted() {
      this.getVisit();

    },
    methods: {
      // 获取访问次数
      getVisit() {
        this.getAxios('/public/get').then(res => {
          this.visitNum = res.data[0].visit_num;
          console.log(this.visitNum);
        }).catch(err => {
          console.log(err);
        })
      },
      //增加访问次数
      setVisit() {
        let num = this.visitNum + 1
        this.putAxios('/public/add?id=1&visit_num=' + num).then(res => {
          console.log(res);
        }).catch(err => {
          console.log(err);
        })
      }
    }
  };
</script>
<style scoped>
  #app {
    overflow: hidden;
  }

  .header-row {
    height: 100vh;
    background-color: salmon;
    padding: 0;
    margin: 0 !important;
    position: fixed;
    right: 0;
    z-index: 100;
  }

  .appRight {
    width: 100%;
    padding: 0 25px;
  }
</style>
